package com.sharemarking.wa.platform.mapper;


import com.sharemarking.wa.platform.dto.orderDispatch.WasteListDto;
import com.sharemarking.wa.platform.dto.receiveOrderDispatch.OrderListDto;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author dxy
 */
@Repository
public interface ReceiveOrderDispatchMapper {

    @Select("SELECT code,id,distance,state,parent_id FROM  wa_order WHERE type = 1 AND state = 5 ORDER BY update_date DESC\n" +
            "LIMIT #{pageIndex},#{pageSize} ")
    List<OrderListDto> getList(Map map);

    @Select("SELECT COUNT(*) FROM  wa_order WHERE type = 1 AND state = 5")
    Integer getListTotal(Map map);

    @Select("SELECT a.name AS wasteName,a.waste_Id,a.weight,b.pic FROM wa_order_details a LEFT JOIN wa_org_waste b ON a.waste_id = b.id " +
            "WHERE a.order_id = #{orderId}")
    List<WasteListDto> getWasteList(Integer orderId);


}
